package com.sihan.framework.etm.controller.baseData;

import com.framework.annotation.BusinessLog;
import com.framework.model.ApiResult;
import com.framework.model.PageResult;
import com.sihan.framework.etm.dto.DevicePageDTO;
import com.sihan.framework.etm.dto.EtmDeviceMountDTO;
import com.sihan.framework.etm.service.baseData.DeviceService;
import com.sihan.framework.etm.vo.baseData.DeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "设备管理")
@RestController
@RequestMapping("/system/v2/device")
public class DeviceV2Controller {
    @Autowired
    private DeviceService deviceService;

    @ApiOperation(value = "设备运行列表", notes = "设备运行列表", response = DeviceVO.class)
    @GetMapping("/run/list")
    @BusinessLog(value = "设备运行列表")
    public ApiResult<?> runDevice(DevicePageDTO dto) {
        PageResult<EtmDeviceMountDTO> result = deviceService.queryDeviceRunningData(dto);
        return ApiResult.success(result);
    }

    @ApiOperation(value = "设备定位列表", notes = "设备定位列表", response = DeviceVO.class)
    @GetMapping("/position/list")
    @BusinessLog(value = "设备定位列表")
    public ApiResult<?> positionDevice(DevicePageDTO dto) {
        PageResult<EtmDeviceMountDTO> result = deviceService.queryDevicePositionData(dto);
        return ApiResult.success(result);
    }
}
